Dynomotion

Group: DynoMotion Message: 2440 From: bradodarb Date: 11/26/2011
Subject: Tool Offsets
Hello Tom,


I belive this is again more of an EMC related question, but I am really close to having MM ready for Carl and any other brave beta testers and hope you can shed some light.

___________Tool Offset Issue______________________

I have implemented methods to define tools in the p_setup.tool_table

GC_dll->p_setup->tool_table[id].length = length;
GC_dll->p_setup->tool_table[id].diameter = diameter;

I also created a method for geting a value by index to verify the settings are correct and 'sticking'.


So if I use an index of 12, that should be addressable via T12/H12/D12 right?

It appears something else needs to be set other than the tool table, but I am not sure what because it is not changing the DRO position while cutting.

However, I can affect the DRO by issuing a python command while interpreting that calls this:

_Controller.Interpreter.SetupParams.ToolLengthOffset = 500

which immediately offsets my Z axis DRO by 500 units.


___________Origin Issue______________________


I also added

int CGCodeInterpreter::SetOrigin(int index, double x, double y, double z)
{
double* pars = p_setup->parameters;

int k = (5200 + (index * 20));

pars[k + 1] = x;
pars[k + 2] = y;
pars[k + 3] = z;

return 0;
}
and


int CGCodeInterpreter::GetOrigin(int index, double *x, double *y, double *z)
{
double* pars = p_setup->parameters;

int k = (5200 + (index * 20));

*x = pars[k + 1];
*y = pars[k + 2];
*z = pars[k + 3];

return 0;
}

to GCodeInterpreter.


Using and index of 1, and setting values

x = 1000;
y = 1000;
z = 1000;

When I call a G54 in my gcode file my DRO values should be offset by 1000 right?

This is not happening, and I am not sure why.


Any thoughts?

Thank you
-Brad Murry
Group: DynoMotion Message: 2448 From: Tom Kerekes Date: 11/26/2011
Subject: Re: Tool Offsets
Hi Brad,
 
I don't know what you are doing looks correct to me.  I'd have to debug it.
 
You do have a G43 with the Hxx correct?
 
Also as you are cutting the DRO should not be any different but the tool position and machine parameters should be different.
 
You might check if the #Vars are actually changing.  I guess there is no way to print them but you might move an axis to them as a test ie:
 
G0 A#5200
 
Regards
TK
 
 

Group: DynoMotion Message: 2449 From: brad murry Date: 11/26/2011
Subject: Re: Tool Offsets
Hello Tom,

I am calling the G54 H12 in my program, what I was describing before was the method I am using to populate the tool table and offset parameters since I am bypassing the config files(EMC.var, etc...) and defining everything through my own XML files.

I am fairly confident that the values are being set correctly, and both the standalone interpreter as well as the canonical calls seem straight forward and should be working properly.  I must be referencing a rouge instance of the setupparams or found something else wrong.  I'll debug it later and hopefully get to the bottom of it quickly.  These are the last issues before MM is serviceable.

-Brad Murry

From: Tom Kerekes
Sent: 11/26/2011 1:14 PM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] Tool Offsets

 

Hi Brad,
 
I don't know what you are doing looks correct to me.  I'd have to debug it.
 
You do have a G43 with the Hxx correct?
 
Also as you are cutting the DRO should not be any different but the tool position and machine parameters should be different.
 
You might check if the #Vars are actually changing.  I guess there is no way to print them but you might move an axis to them as a test ie:
 
G0 A#5200
 
Regards
TK
 
 

From: bradodarb <bradodarb@...>
To: DynoMotion@yahoogroups.com
Sent: Saturday, November 26, 2011 9:07 AM
Subject: [DynoMotion] Tool Offsets

 
Hello Tom,

I belive this is again more of an EMC related question, but I am really close to having MM ready for Carl and any other brave beta testers and hope you can shed some light.

___________Tool Offset Issue______________________

I have implemented methods to define tools in the p_setup.tool_table

GC_dll->p_setup->tool_table[id].length = length;
GC_dll->p_setup->tool_table[id].diameter = diameter;

I also created a method for geting a value by index to verify the settings are correct and 'sticking'.

So if I use an index of 12, that should be addressable via T12/H12/D12 right?

It appears something else needs to be set other than the tool table, but I am not sure what because it is not changing the DRO position while cutting.

However, I can affect the DRO by issuing a python command while interpreting that calls this:

_Controller.Interpreter.SetupParams.ToolLengthOffset = 500

which immediately offsets my Z axis DRO by 500 units.

___________Origin Issue______________________

I also added

int CGCodeInterpreter::SetOrigin(int index, double x, double y, double z)
{
double* pars = p_setup->parameters;

int k = (5200 + (index * 20));

pars[k + 1] = x;
pars[k + 2] = y;
pars[k + 3] = z;

return 0;
}
and

int CGCodeInterpreter::GetOrigin(int index, double *x, double *y, double *z)
{
double* pars = p_setup->parameters;

int k = (5200 + (index * 20));

*x = pars[k + 1];
*y = pars[k + 2];
*z = pars[k + 3];

return 0;
}

to GCodeInterpreter.

Using and index of 1, and setting values

x = 1000;
y = 1000;
z = 1000;

When I call a G54 in my gcode file my DRO values should be offset by 1000 right?

This is not happening, and I am not sure why.

Any thoughts?

Thank you
-Brad Murry



Group: DynoMotion Message: 2450 From: Tom Kerekes Date: 11/26/2011
Subject: Re: Tool Offsets
Hi Brad,
 
You may be right but I think you need a G43 H12 to turn on length compensation.  The H alone won't do it.  Otherwise I think the interpreter should give an error.
 
TK
 
 

Group: DynoMotion Message: 2451 From: brad murry Date: 11/26/2011
Subject: Re: Tool Offsets
I am using both for sure.....sorry to be unclear earlier. I must be missing something else.

-Brad Murry

From: Tom Kerekes
Sent: 11/26/2011 4:37 PM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] Tool Offsets

 

Hi Brad,
 
You may be right but I think you need a G43 H12 to turn on length compensation.  The H alone won't do it.  Otherwise I think the interpreter should give an error.
 
TK
 
 

From: brad murry <bradodarb@...>
To: "DynoMotion@yahoogroups.com" <DynoMotion@yahoogroups.com>
Sent: Saturday, November 26, 2011 3:31 PM
Subject: RE: [DynoMotion] Tool Offsets

 
Hello Tom,

I am calling the G54 H12 in my program, what I was describing before was the method I am using to populate the tool table and offset parameters since I am bypassing the config files(EMC.var, etc...) and defining everything through my own XML files.

I am fairly confident that the values are being set correctly, and both the standalone interpreter as well as the canonical calls seem straight forward and should be working properly.  I must be referencing a rouge instance of the setupparams or found something else wrong.  I'll debug it later and hopefully get to the bottom of it quickly.  These are the last issues before MM is serviceable.

-Brad Murry
From: Tom Kerekes
Sent: 11/26/2011 1:14 PM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] Tool Offsets

 
Hi Brad,
 
I don't know what you are doing looks correct to me.  I'd have to debug it.
 
You do have a G43 with the Hxx correct?
 
Also as you are cutting the DRO should not be any different but the tool position and machine parameters should be different.
 
You might check if the #Vars are actually changing.  I guess there is no way to print them but you might move an axis to them as a test ie:
 
G0 A#5200
 
Regards
TK
 
 

From: bradodarb <bradodarb@...>
To: DynoMotion@yahoogroups.com
Sent: Saturday, November 26, 2011 9:07 AM
Subject: [DynoMotion] Tool Offsets

 
Hello Tom,

I belive this is again more of an EMC related question, but I am really close to having MM ready for Carl and any other brave beta testers and hope you can shed some light.

___________Tool Offset Issue______________________

I have implemented methods to define tools in the p_setup.tool_table

GC_dll->p_setup->tool_table[id].length = length;
GC_dll->p_setup->tool_table[id].diameter = diameter;

I also created a method for geting a value by index to verify the settings are correct and 'sticking'.

So if I use an index of 12, that should be addressable via T12/H12/D12 right?

It appears something else needs to be set other than the tool table, but I am not sure what because it is not changing the DRO position while cutting.

However, I can affect the DRO by issuing a python command while interpreting that calls this:

_Controller.Interpreter.SetupParams.ToolLengthOffset = 500

which immediately offsets my Z axis DRO by 500 units.

___________Origin Issue______________________

I also added

int CGCodeInterpreter::SetOrigin(int index, double x, double y, double z)
{
double* pars = p_setup->parameters;

int k = (5200 + (index * 20));

pars[k + 1] = x;
pars[k + 2] = y;
pars[k + 3] = z;

return 0;
}
and

int CGCodeInterpreter::GetOrigin(int index, double *x, double *y, double *z)
{
double* pars = p_setup->parameters;

int k = (5200 + (index * 20));

*x = pars[k + 1];
*y = pars[k + 2];
*z = pars[k + 3];

return 0;
}

to GCodeInterpreter.

Using and index of 1, and setting values

x = 1000;
y = 1000;
z = 1000;

When I call a G54 in my gcode file my DRO values should be offset by 1000 right?

This is not happening, and I am not sure why.

Any thoughts?

Thank you
-Brad Murry





Group: DynoMotion Message: 2458 From: bradodarb Date: 11/28/2011
Subject: Re: Tool Offsets
Have you tried stting the tool table manually in KMotion?

I set the toolfile name to"" and accessed the tool table array index
as I did from MM with the same results


-Brad

--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Brad,
>  
> I don't know what you are doing looks correct to me.  I'd have to debug it.
>  
> You do have a G43 with the Hxx correct?
>  
> Also as you are cutting the DRO should not be any different but the tool position and machine parameters should be different.
>  
> You might check if the #Vars are actually changing.  I guess there is no way to print them but you might move an axis to them as a test ie:
>  
> G0 A#5200
>  
> Regards
> TK
>  
>  
>
> From: bradodarb <bradodarb@...>
> To: DynoMotion@yahoogroups.com
> Sent: Saturday, November 26, 2011 9:07 AM
> Subject: [DynoMotion] Tool Offsets
>
>
>  
> Hello Tom,
>
> I belive this is again more of an EMC related question, but I am really close to having MM ready for Carl and any other brave beta testers and hope you can shed some light.
>
> ___________Tool Offset Issue______________________
>
> I have implemented methods to define tools in the p_setup.tool_table
>
> GC_dll->p_setup->tool_table[id].length = length;
> GC_dll->p_setup->tool_table[id].diameter = diameter;
>
> I also created a method for geting a value by index to verify the settings are correct and 'sticking'.
>
> So if I use an index of 12, that should be addressable via T12/H12/D12 right?
>
> It appears something else needs to be set other than the tool table, but I am not sure what because it is not changing the DRO position while cutting.
>
> However, I can affect the DRO by issuing a python command while interpreting that calls this:
>
> _Controller.Interpreter.SetupParams.ToolLengthOffset = 500
>
> which immediately offsets my Z axis DRO by 500 units.
>
> ___________Origin Issue______________________
>
> I also added
>
> int CGCodeInterpreter::SetOrigin(int index, double x, double y, double z)
> {
> double* pars = p_setup->parameters;
>
> int k = (5200 + (index * 20));
>
> pars[k + 1] = x;
> pars[k + 2] = y;
> pars[k + 3] = z;
>
> return 0;
> }
> and
>
> int CGCodeInterpreter::GetOrigin(int index, double *x, double *y, double *z)
> {
> double* pars = p_setup->parameters;
>
> int k = (5200 + (index * 20));
>
> *x = pars[k + 1];
> *y = pars[k + 2];
> *z = pars[k + 3];
>
> return 0;
> }
>
> to GCodeInterpreter.
>
> Using and index of 1, and setting values
>
> x = 1000;
> y = 1000;
> z = 1000;
>
> When I call a G54 in my gcode file my DRO values should be offset by 1000 right?
>
> This is not happening, and I am not sure why.
>
> Any thoughts?
>
> Thank you
> -Brad Murry
>
Group: DynoMotion Message: 2460 From: Tom Kerekes Date: 11/28/2011
Subject: Re: Tool Offsets
Hi Brad
 
I'm not sure exactly what you mean.
 
But here is what I tried:
 
Set the Tool Table name to "" otherwise it will reload the tool table from disk every time the Interpreter starts executing.
 
I then set a breakpoint in KMotionCNC and used the debugger to set:
 
  TheFrame->GCodeDlg.Interpreter.p_setup->tool_table[3].length  1.1230000000000000 double
I then ran GCode of
 
G43 H3 (Tool #3 length comp On)
 
I observe the Z DRO change by 1.123
 
Regards
TK

Group: DynoMotion Message: 2461 From: Brad Murry Date: 11/28/2011
Subject: Re: Tool Offsets

Thanks Tom,

 

Did you set the tool value before or after interpreter cycle start?

 

-Brad Murry

 

From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com] On Behalf Of Tom Kerekes
Sent: Monday, November 28, 2011 5:08 PM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] Re: Tool Offsets

 

 

Hi Brad

 

I'm not sure exactly what you mean.

 

But here is what I tried:

 

Set the Tool Table name to "" otherwise it will reload the tool table from disk every time the Interpreter starts executing.

 

I then set a breakpoint in KMotionCNC and used the debugger to set:

 

  TheFrame->GCodeDlg.Interpreter.p_setup->tool_table[3].length  1.1230000000000000 double

I then ran GCode of

 

G43 H3 (Tool #3 length comp On)

 

I observe the Z DRO change by 1.123

 

Regards

TK

 

From: bradodarb <bradodarb@...>
To: DynoMotion@yahoogroups.com
Sent: Monday, November 28, 2011 11:09 AM
Subject: [DynoMotion] Re: Tool Offsets

 

Have you tried stting the tool table manually in KMotion?

I set the toolfile name to"" and accessed the tool table array index
as I did from MM with the same results

-Brad

--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Brad,
>  
> I don't know what you are doing looks correct to me.  I'd have to debug it.
>  
> You do have a G43 with the Hxx correct?
>  
> Also as you are cutting the DRO should not be any different but the tool position and machine parameters should be different.
>  
> You might check if the #Vars are actually changing.  I guess there is no way to print them but you might move an axis to them as a test ie:
>  
> G0 A#5200
>  
> Regards
> TK
>  
>  
>
> From: bradodarb <bradodarb@...>
> To: DynoMotion@yahoogroups.com
> Sent: Saturday, November 26, 2011 9:07 AM
> Subject: [DynoMotion] Tool Offsets
>
>
>  
> Hello Tom,
>
> I belive this is again more of an EMC related question, but I am really close to having MM ready for Carl and any other brave beta testers and hope you can shed some light.
>
> ___________Tool Offset Issue______________________
>
> I have implemented methods to define tools in the p_setup.tool_table
>
> GC_dll->p_setup->tool_table[id].length = length;
> GC_dll->p_setup->tool_table[id].diameter = diameter;
>
> I also created a method for geting a value by index to verify the settings are correct and 'sticking'.
>
> So if I use an index of 12, that should be addressable via T12/H12/D12 right?
>
> It appears something else needs to be set other than the tool table, but I am not sure what because it is not changing the DRO position while cutting.
>
> However, I can affect the DRO by issuing a python command while interpreting that calls this:
>
> _Controller.Interpreter.SetupParams.ToolLengthOffset = 500
>
> which immediately offsets my Z axis DRO by 500 units.
>
> ___________Origin Issue______________________
>
> I also added
>
> int CGCodeInterpreter::SetOrigin(int index, double x, double y, double z)
> {
> double* pars = p_setup->parameters;
>
> int k = (5200 + (index * 20));
>
> pars[k + 1] = x;
> pars[k + 2] = y;
> pars[k + 3] = z;
>
> return 0;
> }
> and
>
> int CGCodeInterpreter::GetOrigin(int index, double *x, double *y, double *z)
> {
> double* pars = p_setup->parameters;
>
> int k = (5200 + (index * 20));
>
> *x = pars[k + 1];
> *y = pars[k + 2];
> *z = pars[k + 3];
>
> return 0;
> }
>
> to GCodeInterpreter.
>
> Using and index of 1, and setting values
>
> x = 1000;
> y = 1000;
> z = 1000;
>
> When I call a G54 in my gcode file my DRO values should be offset by 1000 right?
>
> This is not happening, and I am not sure why.
>
> Any thoughts?
>
> Thank you
> -Brad Murry
>

 

Group: DynoMotion Message: 2462 From: Tom Kerekes Date: 11/28/2011
Subject: Re: Tool Offsets
Before.  I set a breakpoint in my edit table button (which thows an error because no file specified).  Changed the value with the debugger in VS.  Hit "Run" in VS.  Hit "Single Step" in KMotionCNC.
 
TK

Group: DynoMotion Message: 2463 From: bradodarb Date: 11/28/2011
Subject: Re: Tool Offsets
Hello Tom,

I had a Z word on the same line which the EMC apparently does not like. After moving the Z word to the next line, the machine coordinates changed accordingly.

I do however have some wierdness on the .net side...

If I set the tool table prior to calling Interpreter.Interpret the tool table(and likely the parameter file) seems to be reset.


I can get it to take effect if I set the tool length after calling Interpret(args...) - But ONLY if I call a Thread.Sleep(>0)!

So even 1 ms seems to make it 'stick', which makes me think the tool table is being read.

In the initialization of the CGcodeInterpreter in dot_netInterop.dll (new)

I tried
... GC = new CGCodeInterpreter;

1)
leaving the ToolFile and SetupFile alone.
,
2)
strcpy(GC->ToolFile,"");
strcpy(GC->SetupFile,"");

and
3)
GC_dll->ToolFile[0]=0;
GC_dll->SetupFile[0]=0;

And all yeild the same results.

Very strange, but I think I am getting closer to the problem.


Any Ideas?

-Brad Murry


--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Before.  I set a breakpoint in my edit table button (which thows an error because no file specified).  Changed the value with the debugger in VS.  Hit "Run" in VS.  Hit "Single Step" in KMotionCNC.
>  
> TK
>
> From: Brad Murry <bradodarb@...>
> To: DynoMotion@yahoogroups.com
> Sent: Monday, November 28, 2011 4:28 PM
> Subject: RE: [DynoMotion] Re: Tool Offsets
>
>
>  
> Thanks Tom,
>  
> Did you set the tool value before or after interpreter cycle start?
>  
> -Brad Murry
>  
> From:DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com] On Behalf Of Tom Kerekes
> Sent: Monday, November 28, 2011 5:08 PM
> To: DynoMotion@yahoogroups.com
> Subject: Re: [DynoMotion] Re: Tool Offsets
>  
>  
> Hi Brad
>  
> I'm not sure exactly what you mean.
>  
> But here is what I tried:
>  
> Set the Tool Table name to "" otherwise it will reload the tool table from disk every time the Interpreter starts executing.
>  
> I then set a breakpoint in KMotionCNC and used the debugger to set:
>  
>   TheFrame->GCodeDlg.Interpreter.p_setup->tool_table[3].length  1.1230000000000000 double
> I then ran GCode of
>  
> G43 H3 (Tool #3 length comp On)
>  
> I observe the Z DRO change by 1.123
>  
> Regards
> TK
>  
> From:bradodarb <bradodarb@...>
> To: DynoMotion@yahoogroups.com
> Sent: Monday, November 28, 2011 11:09 AM
> Subject: [DynoMotion] Re: Tool Offsets
>  
> Have you tried stting the tool table manually in KMotion?
>
> I set the toolfile name to"" and accessed the tool table array index
> as I did from MM with the same results
>
> -Brad
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Brad,
> >  
> > I don't know what you are doing looks correct to me.  I'd have to debug it.
> >  
> > You do have a G43 with the Hxx correct?
> >  
> > Also as you are cutting the DRO should not be any different but the tool position and machine parameters should be different.
> >  
> > You might check if the #Vars are actually changing.  I guess there is no way to print them but you might move an axis to them as a test ie:
> >  
> > G0 A#5200
> >  
> > Regards
> > TK
> >  
> >  
> >
> > From: bradodarb <bradodarb@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Saturday, November 26, 2011 9:07 AM
> > Subject: [DynoMotion] Tool Offsets
> >
> >
> >  
> > Hello Tom,
> >
> > I belive this is again more of an EMC related question, but I am really close to having MM ready for Carl and any other brave beta testers and hope you can shed some light.
> >
> > ___________Tool Offset Issue______________________
> >
> > I have implemented methods to define tools in the p_setup.tool_table
> >
> > GC_dll->p_setup->tool_table[id].length = length;
> > GC_dll->p_setup->tool_table[id].diameter = diameter;
> >
> > I also created a method for geting a value by index to verify the settings are correct and 'sticking'.
> >
> > So if I use an index of 12, that should be addressable via T12/H12/D12 right?
> >
> > It appears something else needs to be set other than the tool table, but I am not sure what because it is not changing the DRO position while cutting.
> >
> > However, I can affect the DRO by issuing a python command while interpreting that calls this:
> >
> > _Controller.Interpreter.SetupParams.ToolLengthOffset = 500
> >
> > which immediately offsets my Z axis DRO by 500 units.
> >
> > ___________Origin Issue______________________
> >
> > I also added
> >
> > int CGCodeInterpreter::SetOrigin(int index, double x, double y, double z)
> > {
> > double* pars = p_setup->parameters;
> >
> > int k = (5200 + (index * 20));
> >
> > pars[k + 1] = x;
> > pars[k + 2] = y;
> > pars[k + 3] = z;
> >
> > return 0;
> > }
> > and
> >
> > int CGCodeInterpreter::GetOrigin(int index, double *x, double *y, double *z)
> > {
> > double* pars = p_setup->parameters;
> >
> > int k = (5200 + (index * 20));
> >
> > *x = pars[k + 1];
> > *y = pars[k + 2];
> > *z = pars[k + 3];
> >
> > return 0;
> > }
> >
> > to GCodeInterpreter.
> >
> > Using and index of 1, and setting values
> >
> > x = 1000;
> > y = 1000;
> > z = 1000;
> >
> > When I call a G54 in my gcode file my DRO values should be offset by 1000 right?
> >
> > This is not happening, and I am not sure why.
> >
> > Any thoughts?
> >
> > Thank you
> > -Brad Murry
> >
>  
>
Group: DynoMotion Message: 2464 From: bradodarb Date: 11/28/2011
Subject: Re: Tool Offsets
I think it is getting reset here::
CGCodeInterpreter::InitializeInterp()
....
...
..
|
|__\
/
rs274ngc_init()
....
...
..
|
|__\
/
rs274ngc_synch();
....
...
..
|
|__\
/ rs274ngc_load_tool_table();



And here is where we are getting reset::
int rs274ngc_load_tool_table()
{ /* NO ARGUMENTS */
static char name[] = "rs274ngc_load_tool_table";
int n;

CHK((_setup.tool_max > CANON_TOOL_MAX), NCE_TOOL_MAX_TOO_LARGE);
for (n = 0; n <= _setup.tool_max; n++) {
_setup.tool_table[n] = GET_EXTERNAL_TOOL_TABLE(n);
}
for (; n <= CANON_TOOL_MAX; n++) {
_setup.tool_table[n].id = 0;
_setup.tool_table[n].length = 0;
_setup.tool_table[n].diameter = 0;
}

return RS274NGC_OK;
}


I think if I call InitializeInterp() when the CGcodeInterpreter is created, always set m_restart on the Interpret call to false and set m_InitializeOnExecute to false it should work.


-Brad Murry


--- In DynoMotion@yahoogroups.com, "bradodarb" <bradodarb@...> wrote:
>
> Hello Tom,
>
> I had a Z word on the same line which the EMC apparently does not like. After moving the Z word to the next line, the machine coordinates changed accordingly.
>
> I do however have some wierdness on the .net side...
>
> If I set the tool table prior to calling Interpreter.Interpret the tool table(and likely the parameter file) seems to be reset.
>
>
> I can get it to take effect if I set the tool length after calling Interpret(args...) - But ONLY if I call a Thread.Sleep(>0)!
>
> So even 1 ms seems to make it 'stick', which makes me think the tool table is being read.
>
> In the initialization of the CGcodeInterpreter in dot_netInterop.dll (new)
>
> I tried
> ... GC = new CGCodeInterpreter;
>
> 1)
> leaving the ToolFile and SetupFile alone.
> ,
> 2)
> strcpy(GC->ToolFile,"");
> strcpy(GC->SetupFile,"");
>
> and
> 3)
> GC_dll->ToolFile[0]=0;
> GC_dll->SetupFile[0]=0;
>
> And all yeild the same results.
>
> Very strange, but I think I am getting closer to the problem.
>
>
> Any Ideas?
>
> -Brad Murry
>
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Before.  I set a breakpoint in my edit table button (which thows an error because no file specified).  Changed the value with the debugger in VS.  Hit "Run" in VS.  Hit "Single Step" in KMotionCNC.
> >  
> > TK
> >
> > From: Brad Murry <bradodarb@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Monday, November 28, 2011 4:28 PM
> > Subject: RE: [DynoMotion] Re: Tool Offsets
> >
> >
> >  
> > Thanks Tom,
> >  
> > Did you set the tool value before or after interpreter cycle start?
> >  
> > -Brad Murry
> >  
> > From:DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com] On Behalf Of Tom Kerekes
> > Sent: Monday, November 28, 2011 5:08 PM
> > To: DynoMotion@yahoogroups.com
> > Subject: Re: [DynoMotion] Re: Tool Offsets
> >  
> >  
> > Hi Brad
> >  
> > I'm not sure exactly what you mean.
> >  
> > But here is what I tried:
> >  
> > Set the Tool Table name to "" otherwise it will reload the tool table from disk every time the Interpreter starts executing.
> >  
> > I then set a breakpoint in KMotionCNC and used the debugger to set:
> >  
> >   TheFrame->GCodeDlg.Interpreter.p_setup->tool_table[3].length  1.1230000000000000 double
> > I then ran GCode of
> >  
> > G43 H3 (Tool #3 length comp On)
> >  
> > I observe the Z DRO change by 1.123
> >  
> > Regards
> > TK
> >  
> > From:bradodarb <bradodarb@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Monday, November 28, 2011 11:09 AM
> > Subject: [DynoMotion] Re: Tool Offsets
> >  
> > Have you tried stting the tool table manually in KMotion?
> >
> > I set the toolfile name to"" and accessed the tool table array index
> > as I did from MM with the same results
> >
> > -Brad
> >
> > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > >
> > > Hi Brad,
> > >  
> > > I don't know what you are doing looks correct to me.  I'd have to debug it.
> > >  
> > > You do have a G43 with the Hxx correct?
> > >  
> > > Also as you are cutting the DRO should not be any different but the tool position and machine parameters should be different.
> > >  
> > > You might check if the #Vars are actually changing.  I guess there is no way to print them but you might move an axis to them as a test ie:
> > >  
> > > G0 A#5200
> > >  
> > > Regards
> > > TK
> > >  
> > >  
> > >
> > > From: bradodarb <bradodarb@>
> > > To: DynoMotion@yahoogroups.com
> > > Sent: Saturday, November 26, 2011 9:07 AM
> > > Subject: [DynoMotion] Tool Offsets
> > >
> > >
> > >  
> > > Hello Tom,
> > >
> > > I belive this is again more of an EMC related question, but I am really close to having MM ready for Carl and any other brave beta testers and hope you can shed some light.
> > >
> > > ___________Tool Offset Issue______________________
> > >
> > > I have implemented methods to define tools in the p_setup.tool_table
> > >
> > > GC_dll->p_setup->tool_table[id].length = length;
> > > GC_dll->p_setup->tool_table[id].diameter = diameter;
> > >
> > > I also created a method for geting a value by index to verify the settings are correct and 'sticking'.
> > >
> > > So if I use an index of 12, that should be addressable via T12/H12/D12 right?
> > >
> > > It appears something else needs to be set other than the tool table, but I am not sure what because it is not changing the DRO position while cutting.
> > >
> > > However, I can affect the DRO by issuing a python command while interpreting that calls this:
> > >
> > > _Controller.Interpreter.SetupParams.ToolLengthOffset = 500
> > >
> > > which immediately offsets my Z axis DRO by 500 units.
> > >
> > > ___________Origin Issue______________________
> > >
> > > I also added
> > >
> > > int CGCodeInterpreter::SetOrigin(int index, double x, double y, double z)
> > > {
> > > double* pars = p_setup->parameters;
> > >
> > > int k = (5200 + (index * 20));
> > >
> > > pars[k + 1] = x;
> > > pars[k + 2] = y;
> > > pars[k + 3] = z;
> > >
> > > return 0;
> > > }
> > > and
> > >
> > > int CGCodeInterpreter::GetOrigin(int index, double *x, double *y, double *z)
> > > {
> > > double* pars = p_setup->parameters;
> > >
> > > int k = (5200 + (index * 20));
> > >
> > > *x = pars[k + 1];
> > > *y = pars[k + 2];
> > > *z = pars[k + 3];
> > >
> > > return 0;
> > > }
> > >
> > > to GCodeInterpreter.
> > >
> > > Using and index of 1, and setting values
> > >
> > > x = 1000;
> > > y = 1000;
> > > z = 1000;
> > >
> > > When I call a G54 in my gcode file my DRO values should be offset by 1000 right?
> > >
> > > This is not happening, and I am not sure why.
> > >
> > > Any thoughts?
> > >
> > > Thank you
> > > -Brad Murry
> > >
> >  
> >
>
Group: DynoMotion Message: 2465 From: bradodarb Date: 11/28/2011
Subject: Re: Tool Offsets
Yep, adding members for InitializeOnExecute and InitializeInterp()
allows me to init from a file if I want and suppress it on subsequent Interpret() calls.

It should now be able to work as normal using the typical files or have the setup and tool table params defined externally.

-Brad

--- In DynoMotion@yahoogroups.com, "bradodarb" <bradodarb@...> wrote:
>
> I think it is getting reset here::
> CGCodeInterpreter::InitializeInterp()
> ....
> ...
> ..
> |
> |__\
> /
> rs274ngc_init()
> ....
> ...
> ..
> |
> |__\
> /
> rs274ngc_synch();
> ....
> ...
> ..
> |
> |__\
> / rs274ngc_load_tool_table();
>
>
>
> And here is where we are getting reset::
> int rs274ngc_load_tool_table()
> { /* NO ARGUMENTS */
> static char name[] = "rs274ngc_load_tool_table";
> int n;
>
> CHK((_setup.tool_max > CANON_TOOL_MAX), NCE_TOOL_MAX_TOO_LARGE);
> for (n = 0; n <= _setup.tool_max; n++) {
> _setup.tool_table[n] = GET_EXTERNAL_TOOL_TABLE(n);
> }
> for (; n <= CANON_TOOL_MAX; n++) {
> _setup.tool_table[n].id = 0;
> _setup.tool_table[n].length = 0;
> _setup.tool_table[n].diameter = 0;
> }
>
> return RS274NGC_OK;
> }
>
>
> I think if I call InitializeInterp() when the CGcodeInterpreter is created, always set m_restart on the Interpret call to false and set m_InitializeOnExecute to false it should work.
>
>
> -Brad Murry
>
>
> --- In DynoMotion@yahoogroups.com, "bradodarb" <bradodarb@> wrote:
> >
> > Hello Tom,
> >
> > I had a Z word on the same line which the EMC apparently does not like. After moving the Z word to the next line, the machine coordinates changed accordingly.
> >
> > I do however have some wierdness on the .net side...
> >
> > If I set the tool table prior to calling Interpreter.Interpret the tool table(and likely the parameter file) seems to be reset.
> >
> >
> > I can get it to take effect if I set the tool length after calling Interpret(args...) - But ONLY if I call a Thread.Sleep(>0)!
> >
> > So even 1 ms seems to make it 'stick', which makes me think the tool table is being read.
> >
> > In the initialization of the CGcodeInterpreter in dot_netInterop.dll (new)
> >
> > I tried
> > ... GC = new CGCodeInterpreter;
> >
> > 1)
> > leaving the ToolFile and SetupFile alone.
> > ,
> > 2)
> > strcpy(GC->ToolFile,"");
> > strcpy(GC->SetupFile,"");
> >
> > and
> > 3)
> > GC_dll->ToolFile[0]=0;
> > GC_dll->SetupFile[0]=0;
> >
> > And all yeild the same results.
> >
> > Very strange, but I think I am getting closer to the problem.
> >
> >
> > Any Ideas?
> >
> > -Brad Murry
> >
> >
> > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > >
> > > Before.  I set a breakpoint in my edit table button (which thows an error because no file specified).  Changed the value with the debugger in VS.  Hit "Run" in VS.  Hit "Single Step" in KMotionCNC.
> > >  
> > > TK
> > >
> > > From: Brad Murry <bradodarb@>
> > > To: DynoMotion@yahoogroups.com
> > > Sent: Monday, November 28, 2011 4:28 PM
> > > Subject: RE: [DynoMotion] Re: Tool Offsets
> > >
> > >
> > >  
> > > Thanks Tom,
> > >  
> > > Did you set the tool value before or after interpreter cycle start?
> > >  
> > > -Brad Murry
> > >  
> > > From:DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com] On Behalf Of Tom Kerekes
> > > Sent: Monday, November 28, 2011 5:08 PM
> > > To: DynoMotion@yahoogroups.com
> > > Subject: Re: [DynoMotion] Re: Tool Offsets
> > >  
> > >  
> > > Hi Brad
> > >  
> > > I'm not sure exactly what you mean.
> > >  
> > > But here is what I tried:
> > >  
> > > Set the Tool Table name to "" otherwise it will reload the tool table from disk every time the Interpreter starts executing.
> > >  
> > > I then set a breakpoint in KMotionCNC and used the debugger to set:
> > >  
> > >   TheFrame->GCodeDlg.Interpreter.p_setup->tool_table[3].length  1.1230000000000000 double
> > > I then ran GCode of
> > >  
> > > G43 H3 (Tool #3 length comp On)
> > >  
> > > I observe the Z DRO change by 1.123
> > >  
> > > Regards
> > > TK
> > >  
> > > From:bradodarb <bradodarb@>
> > > To: DynoMotion@yahoogroups.com
> > > Sent: Monday, November 28, 2011 11:09 AM
> > > Subject: [DynoMotion] Re: Tool Offsets
> > >  
> > > Have you tried stting the tool table manually in KMotion?
> > >
> > > I set the toolfile name to"" and accessed the tool table array index
> > > as I did from MM with the same results
> > >
> > > -Brad
> > >
> > > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > > >
> > > > Hi Brad,
> > > >  
> > > > I don't know what you are doing looks correct to me.  I'd have to debug it.
> > > >  
> > > > You do have a G43 with the Hxx correct?
> > > >  
> > > > Also as you are cutting the DRO should not be any different but the tool position and machine parameters should be different.
> > > >  
> > > > You might check if the #Vars are actually changing.  I guess there is no way to print them but you might move an axis to them as a test ie:
> > > >  
> > > > G0 A#5200
> > > >  
> > > > Regards
> > > > TK
> > > >  
> > > >  
> > > >
> > > > From: bradodarb <bradodarb@>
> > > > To: DynoMotion@yahoogroups.com
> > > > Sent: Saturday, November 26, 2011 9:07 AM
> > > > Subject: [DynoMotion] Tool Offsets
> > > >
> > > >
> > > >  
> > > > Hello Tom,
> > > >
> > > > I belive this is again more of an EMC related question, but I am really close to having MM ready for Carl and any other brave beta testers and hope you can shed some light.
> > > >
> > > > ___________Tool Offset Issue______________________
> > > >
> > > > I have implemented methods to define tools in the p_setup.tool_table
> > > >
> > > > GC_dll->p_setup->tool_table[id].length = length;
> > > > GC_dll->p_setup->tool_table[id].diameter = diameter;
> > > >
> > > > I also created a method for geting a value by index to verify the settings are correct and 'sticking'.
> > > >
> > > > So if I use an index of 12, that should be addressable via T12/H12/D12 right?
> > > >
> > > > It appears something else needs to be set other than the tool table, but I am not sure what because it is not changing the DRO position while cutting.
> > > >
> > > > However, I can affect the DRO by issuing a python command while interpreting that calls this:
> > > >
> > > > _Controller.Interpreter.SetupParams.ToolLengthOffset = 500
> > > >
> > > > which immediately offsets my Z axis DRO by 500 units.
> > > >
> > > > ___________Origin Issue______________________
> > > >
> > > > I also added
> > > >
> > > > int CGCodeInterpreter::SetOrigin(int index, double x, double y, double z)
> > > > {
> > > > double* pars = p_setup->parameters;
> > > >
> > > > int k = (5200 + (index * 20));
> > > >
> > > > pars[k + 1] = x;
> > > > pars[k + 2] = y;
> > > > pars[k + 3] = z;
> > > >
> > > > return 0;
> > > > }
> > > > and
> > > >
> > > > int CGCodeInterpreter::GetOrigin(int index, double *x, double *y, double *z)
> > > > {
> > > > double* pars = p_setup->parameters;
> > > >
> > > > int k = (5200 + (index * 20));
> > > >
> > > > *x = pars[k + 1];
> > > > *y = pars[k + 2];
> > > > *z = pars[k + 3];
> > > >
> > > > return 0;
> > > > }
> > > >
> > > > to GCodeInterpreter.
> > > >
> > > > Using and index of 1, and setting values
> > > >
> > > > x = 1000;
> > > > y = 1000;
> > > > z = 1000;
> > > >
> > > > When I call a G54 in my gcode file my DRO values should be offset by 1000 right?
> > > >
> > > > This is not happening, and I am not sure why.
> > > >
> > > > Any thoughts?
> > > >
> > > > Thank you
> > > > -Brad Murry
> > > >
> > >  
> > >
> >
>
Group: DynoMotion Message: 2470 From: Tom Kerekes Date: 11/29/2011
Subject: Re: Tool Offsets
Hi Brad,
 
Yes I didn't think and was single stepping from the middle of a GCode program which is different from starting at line 1.
 
I remember that at one point I tried initializing in the constructor but that didn't work well because the various files the app reads on startup weren't initialized.
 
This process probably needs to be reviewed but so far no one has complained :}
 
Regards
TK